package Ioc_DI;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TestPostConstruct {
    public TestPostConstruct(){
        System.out.println("执行了构造方法");
    }

    @Autowired
    public void set(Components components){
        System.out.println("这里设置了属性 注入了Components类");
    }
    @PostConstruct
    public void init() {
        System.out.println("执行了@PostConstruct方法");
    }


    @PreDestroy
    public void destroy() {
        System.out.println("准备销毁bean");
    }
}


